function [] = generateMTOWRepport ( aircrafts, engines )

% aircraftId = strcat('Aircraft_config',int2str(aircraftIdx),'.txt')

fileVersion = 1;
fileName = strcat('AircraftsMTOW_v', int2str(fileVersion), '.xls' );

if exist(fileName, 'file')
    fileVersion = fileVersion + 1;
    fileName = strcat('AircraftsMTOW_v', int2str(fileVersion), '.xls' );
end

header = { 'Aircraft', 'Crew', 'Pax', 'Load (lb)', 'Range (nm)', 'Cruise Speed (ft/s)',...
    'Material', 'Loiter Duration (h)', 'Engine','', 'Wcrew (lb)', 'Wpayload (lb)',...
    'Wfuel (lb)', 'Wempty (lb)', 'We/W0',  'MTOW (lb)' };
xlswrite(fileName, header, 1, 'A1');

for i = 1:size(aircrafts,2)

    switch engines(aircrafts(1).idEngine).type
        case 1
            engine = 'Turboprop single engine';
        case 2
            engine = 'Turboprop Twin engine';
        case 3
            engine = 'Turbofan engine';
    end

    aircraftInfo = { strcat('ac_',int2str(i)), aircrafts(i).nbCrew, aircrafts(i).nbPax, aircrafts(i).weights.load,...
        aircrafts(i).range, aircrafts(i).cruiseSpeed, aircrafts(i).structureMaterial, aircrafts(i).loiterDuration,...
        engine, '',...
        aircrafts(i).weights.crew, aircrafts(i).weights.payload, aircrafts(i).weights.fuel,...
        aircrafts(i).weights.empty, aircrafts(i).weights.empty/aircrafts(i).weights.mtow, aircrafts(i).weights.mtow};
    xlswrite(fileName, aircraftInfo, 1, strcat('A', int2str(i+1)) );
    
    disp( strcat('Aircraft Config Copied to xls - aircraft :', int2str(i)) )
end

disp( strcat('File', ' ', fileName, ' created on ' ) )